import Nprogress from 'nprogress'
import 'nprogress/nprogress.css'
import router from '@/router'
import store from '@/store'

router.beforeEach((to, from, next) => {
  Nprogress.start()
  next()
})

router.afterEach((to, from) => {
  // 设置当前的路劲地址到仓库
  store._mutations['common/setCurrentPath'][0](to)
  // 设置对应的title头部文字
  if (to.meta) document.title = to.meta.title || 'anlin的个人项目'
  Nprogress.done()
})
